package ppms.ui.provider;

import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.graphics.Image;

import ppms.commons.data.controller.PropertyDataTreeController;
import ppms.commons.data.entity.DataEntity;
import ppms.commons.data.entity.IDataEntity;

/**
 * 资源树内容提供器
 * @author gavin 2009-4-6
 *
 */
public class PropertyTreeProvider extends LabelProvider implements IStructuredContentProvider, ITreeContentProvider
{

   private PropertyDataTreeController dataController = null;
   
   
    public Object[] getElements(Object arg0)
    {
	
	this.dataController = (PropertyDataTreeController)arg0;
	IDataEntity[] entitys = new DataEntity[4];
	IDataEntity ent;
	
	ent = new DataEntity();
	ent.setValue("A栋");
	entitys[0] = ent;
	
	ent = new DataEntity();
	ent.setValue("B栋");
	entitys[1] = ent;
	
	ent = new DataEntity();
	ent.setValue("C栋");
	entitys[2] = ent;
	
	ent = new DataEntity();
	ent.setValue("D栋");
	entitys[3] = ent;
	
	return entitys;

    }

    public void dispose()
    {
	this.dataController = null;
    }

    public void inputChanged(Viewer arg0, Object arg1, Object arg2)
    {
	// TODO Auto-generated method stub

    }

    public Object[] getChildren(Object arg0)
    {
	return null;
    }

    public Object getParent(Object arg0)
    {

	return null;
    }

    public boolean hasChildren(Object arg0)
    {

	return false;
    }
    
    @Override
    public Image getImage(Object element)
    {
	// TODO Auto-generated method stub
	return super.getImage(element);
    }
    
    @Override
    public String getText(Object element)
    {
	return ((IDataEntity)element).getValue();
    }
}
